from redis import StrictRedis
import pymysql


class Config(object):
    DEBUG = None

    SECRET_KEY = 'wlNIS8u6Bx24lUuLhsnp3GKiQnNursPzwG/Z8Zmg7lMC+g3P4Ocz3/tZDp1AarXYG7s='
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:mysql@localhost/info'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400


class DevelopmentConfig(Config):
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:mysql@localhost/info'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    DEBUG = True


class ProductionConfig(Config):
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:mysql@localhost/info'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    DEBUG = False


config_dict = {
    'development': DevelopmentConfig,
    'production': ProductionConfig
}
